package cn.wolfcode.crm.query;

import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class ChartQueryObject extends QueryObject {

    private Long groupByTypeId;

    private String keyword;

    private String groupType;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    public String getGroupByType(){
        if(this.groupByTypeId == null || this.groupByTypeId == 1){
            return "c.name";
        }else if (this.groupByTypeId == 2){
            return "sta.name";
        }else if(this.groupByTypeId == 3){
            return "d.name";
        }
        return "c.name";
    }
}
